Skip to content

Tour: "Singleton Objects" #312

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 14, 2015
Merged

Conversation

S11001001
Copy link
Contributor

With links from other tour parts.

This is incompatible with #307, but can be renumbered with its script straightforwardly.


## Companions ##

Most singleton objects do not stand alone, but instead are associated with a class of the same name. The “singleton object of the same name” of a case class, mentioned above, is an example of this. When this happens, the singleton object is called the *companion object* of the class, and the class is called the *companion class* of the object. This is so common that it's safe to refer to singleton objects as “companion objects” informally, without much risk of confusion.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't agree with this last sentence; it seems incorrect and misleading to me to call something a "companion object" unless it actually is one. Let's not encourage this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SethTisue I agree.

@SethTisue
Copy link
Member

LGTM except for the one piece of feedback. @S11001001 if you agree and correct it, I'll merge.

@heathermiller
Copy link
Member

Thanks for the review @SethTisue! I'm going to pull this in and add a follow-up commit where I remove the last contentious sentence. That way this is in the docs without any further delay :)

heathermiller added a commit that referenced this pull request Jul 14, 2015
@heathermiller heathermiller merged commit 22e27f1 into scala:master Jul 14, 2015
heathermiller added a commit that referenced this pull request Jul 14, 2015
@S11001001
Copy link
Contributor Author

@SethTisue @heathermiller Thanks for reviewing and merging!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants